home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-04-16 | 2.4 KB | 90 lines | [TEXT/CWIE] |
- // IAExtentCorpus.h
- // Copyright: © 1998 by Apple Computer, Inc., all rights reserved.
- //
- // IAExtentCorpus represents a corpus that is a set of memory-resident strings.
- // The actual body of the strings are maintained in the initial buffer managed by the client.
- // The IAExtentDoc which is a subclass of the IADoc represents an extent of text (string)
- // from the corpus represented by IAExtentCorpus.
- //
-
- #pragma once
- #ifndef IAExtentCorpus_h
- #define IAExtentCorpus_h
-
- #pragma import on
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=power
- #endif
-
- #include "IACorpus.h"
-
- #pragma IA_BEGIN_EXPORTS
-
- const uint32 ExtentCorpusType = 'Ext0';
-
- class RankedHit;
-
- class IAExtentDoc : public IADoc {
- public:
- IAExtentDoc() : fText(NULL), fTextOffset(0), fLength(0), fExtentNumber(0),
- fRank(0), fGroupNumber(0), fHit(NULL) {}
- IAExtentDoc(const byte* buffer, uint32 offset, uint32 textLen, uint32 extentNumber,
- uint32 groupNumber, uint32 rank=0, RankedHit* hit = NULL);
-
- virtual ~IAExtentDoc();
- IAStorable* DeepCopy() const;
- uint32 StoreSize() const;
- void Store(IAOutputBlock* output) const;
- IAStorable* Restore(IAInputBlock* input) const;
- bool LessThan(const IAOrderedStorable* neighbor) const;
- bool Equal(const IAOrderedStorable* neighbor) const;
-
- byte* GetText() const {return fText;}
- uint32 GetLength() const {return fLength;}
- uint32 GetOffset() const {return fTextOffset;}
- byte* GetExtent() const;
-
- void SetRank(uint32 rank) {fRank = rank;}
- void SetRankedHit(RankedHit* rh) {fHit = rh;}
-
- uint32 GetExtentNumber() const {return fExtentNumber;}
- uint32 GetRank() const {return fRank;}
- uint32 GetGroupNumber() const {return fGroupNumber;}
- RankedHit* GetRankedHit() const {return fHit;}
-
- private:
- byte* fText;
- uint32 fTextOffset;
- uint32 fLength;
-
- uint32 fExtentNumber;
- uint32 fRank;
- uint32 fGroupNumber;
- RankedHit* fHit;
-
- };
-
- class IAExtentCorpus : public IACorpus {
- public:
- IAExtentCorpus(uint32 corpType = ExtentCorpusType) : IACorpus(corpType) {fBuffer = NULL;}
- IAExtentCorpus(byte* buffer, uint32 corpType = ExtentCorpusType) : IACorpus(corpType) {fBuffer = buffer;}
-
- virtual ~IAExtentCorpus() {}
-
- IADoc* GetProtoDoc();
- IADocText* GetDocText(const IADoc* doc);
- byte* GetBuffer() const {return fBuffer;}
- private:
- byte* fBuffer;
- };
-
-
- #pragma IA_END_EXPORTS
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=reset
- #endif
-
- #pragma import reset
- #endif
-